var express = require('express');
var userRouter = express.Router();
var UserController =require('../controller/UserController');
var FileUpload =require('../controller/FileUpload');
var JsonMessage =require('../models/JsonMessage');
var EmailController =require('../controller/EmailController');
var UserTaskController =require('../controller/UserTaskController');
/* GET users listing. */
userRouter
    .post('/*', (req,res,next)=>{
        if(req.session.userid!=undefined) {

            next();
        }
        else{

            res.json(new  JsonMessage("3001",null,"You haven't login,jump to home page"))

        }
    })

    .post('/catUserAccount', UserController.catUserAccount)
    .post('/modifyUserAccount',UserController.modifyUserAccount)
    .post('/catMyTasks',UserController.catUserAccount)
    .post('/cancelOneTask',UserController.cancelOneTask)
    .post('/createTasksEmailNotifications',UserController.createTasksEmailNotifications)
    .post('/selectUserTommorrowTasks',UserTaskController.selectTommorrowTasks)
    .post('/selectUserTodayTasks',UserController.selectTodayTasks)
    .post('/upload',FileUpload.fileupload)
    .post('/updateTaskEmailNotificationStatus',EmailController.taskEmailNotification)
    .post('/submitTask',UserTaskController.submitTask)
    .post('/selectUserTodayTasksTimeEsc',UserTaskController.selectUserTodayTasksTimeEsc)
    .post('/selectUserTodayTasksTimeDesc',UserTaskController.selectUserTodayTasksTimeDesc)
    .post('/selectUserTomorrowTasksEscTime',UserTaskController.selectUserTomorrowTasksEscTime)
    .post('/selectUserTomorrowTasksDescTime',UserTaskController.selectUserTomorrowTasksDescTime)
module.exports = userRouter;